<template>
  <el-dialog
    :visible.sync="visible"
    :close-on-click-modal="false"
    :before-close="handleBeforClose"
    append-to-body
    top="30px"
    width="80%"
  >
    <el-tabs>
      <el-tab-pane label="基本信息">
        <project-info :related-data="relatedData"></project-info>
      </el-tab-pane>
      <el-tab-pane label="立项信息">
        <approve-edit :query-id="queryId" view-mode v-if="hasItem"></approve-edit>
        <div v-else-if="+relatedData.item_status === 2">
          <confuse-view :related-data="relatedData"></confuse-view>
        </div>
        <div v-else class="empty-wrap">未立项</div>
      </el-tab-pane>
      <el-tab-pane label="数字档案卡">
        <credit-file :query-id="queryId" view-mode></credit-file>
      </el-tab-pane>
      <el-tab-pane label="担保意向函" name="letter" v-if="hasItem">
        <letter-view :query-id="queryId"></letter-view>
      </el-tab-pane>
      <el-tab-pane label="附件">
        <attach-view :queryId="queryId" :visible="visible"></attach-view>
      </el-tab-pane>
    </el-tabs>
  </el-dialog>
</template>

<script>
import CreditFile from '@/credit/components/creditFile/CreditCard'
import AttachView from '@/credit/components/AttachView'
import ProjectInfo from '@/bank/views/business/library/ProjectInfo'
import ConfuseView from '@/credit/views/city/bus/normal/item/ConfuseView'
import ApproveEdit from '@/credit/views/county/unionProvince/components/ApproveEdit'
import LetterView from '@/credit/views/county/unionProvince/components/LetterView'
export default {
  components: {
    ProjectInfo,
    CreditFile,
    AttachView,
    ConfuseView,
    ApproveEdit,
    LetterView,
  },
  props: {
    visible: Boolean,
    relatedData: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {}
  },
  computed: {
    hasItem() {
      return +this.relatedData.item_status === 1
    },
    queryId() {
      return this.relatedData.customer_related_id
    },
  },
  watch: {},
  created() {},
  mounted() {},
  methods: {
    handleBeforClose() {
      this.$emit('update:visible', false)
    },
  },
}
</script>

<style lang="scss" scoped></style>
